//
//  SignSetViewController.m
//  fitnessmanage
//
//  Created by wujian on 2017/12/15.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "SignSetViewController.h"

@interface SignSetTableViewCell : UITableViewCell

@property(nonatomic,weak)CommentSwitchView *switchView;

@end

@implementation SignSetTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        CommentSwitchView *switchView = [[CommentSwitchView alloc] init];
        [self.contentView addSubview:switchView];
        self.switchView = switchView;
     
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.switchView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.mas_equalTo(self.contentView);
    }];
    
}

@end











@interface SignSetViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,weak)UITableView *tableView;

@end

@implementation SignSetViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];

    self.title = @"设置签到/签出通知";
    
    [self createSubView];
}

#pragma mark 创建子视图
-(void)createSubView{
    
    UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
    tableView.dataSource = self;
    tableView.delegate = self;
    tableView.showsVerticalScrollIndicator = NO;
    tableView.estimatedRowHeight = 200;
    [tableView registerClass:[SignSetTableViewCell class] forCellReuseIdentifier:@"SignSetTableViewCell"];
    tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    tableView.backgroundColor = BackGroundColor;
    [self.view addSubview:tableView];
    [tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.mas_equalTo(self.view);
    }];
    self.tableView = tableView;
    
    UIView *tableHeadView = [[UIView alloc] init];
    tableHeadView.backgroundColor = CSColorFromRGB(0xfaf6eb);
    UIImageView *headImageView = [[UIImageView alloc] init];
    headImageView.image = [UIImage imageNamed:@"prompt_icon_careful"];
    [tableHeadView addSubview:headImageView];
    [headImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(tableHeadView).offset(13);
        make.left.mas_equalTo(tableHeadView).offset(13);
    }];
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = @"开启通知后，会员在该场馆扫码二维码签到时，您的手机将收到通知以便及时处理";
    titleLabel.font = MidFont;
    titleLabel.numberOfLines = 0;
    titleLabel.lineBreakMode = NSLineBreakByCharWrapping;
    titleLabel.textColor = CSColorFromRGB(0x737373);
    [tableHeadView addSubview:titleLabel];
    [titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(tableHeadView).offset(10);
        make.right.mas_equalTo(tableHeadView).offset(-10);
        make.left.mas_equalTo(headImageView.mas_right).offset(13);
        make.bottom.mas_equalTo(tableHeadView).offset(-10);
    }];
    [self.view addSubview:tableHeadView];
    [tableHeadView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(tableView);
        make.left.width.mas_equalTo(self.view);
    }];
    [tableHeadView setNeedsLayout];
    [tableHeadView layoutIfNeeded];
    tableView.tableHeaderView = tableHeadView;
}

#pragma mark UITableViewDataSource

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataSource.count;
}

#pragma mark UITableViewDelegate

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 0.00001;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.00001;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    SignSetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SignSetTableViewCell"];
//
//
//    NSDictionary *dict = [self.dataSource objectAtIndex:indexPath.row];
//
//    VenueModel *venueModel = [VenueModel mj_objectWithKeyValues:dict];
//
//    cell.switchView.titleLabel.text = venueModel.venueName;
//
//    [cell.switchView.titleSwitch setOn:YES];
//
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return nil;
}

#pragma mark Get
-(NSMutableArray *)dataSource{
    
    if (!_dataSource) {
        
        _dataSource = [[NSMutableArray alloc] init];
    }
    
    return _dataSource;
}

@end
